home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / xcmd / dxcmds34.sit / Dartmouth XCMD's 3.4.3 / card_8998.txt < prev    next >
Text File  |  1990-04-17  |  5KB  |  180 lines

  1. -- card: 8998 from stack: in.3
  2. -- bmap block id: 9242
  3. -- flags: 4000
  4. -- background id: 8327
  5. -- name: XScrollBoxM
  6. ----- HyperTalk script -----
  7. on Install
  8.   get ChooseTargetStack()
  9.   InstallResource XFCN,XScrollBoxM,it
  10.   InstallResource DITL,XScrollBoxM,it
  11.   InstallResource DLOG,XScrollBoxM,it
  12. end Install
  13.  
  14.  
  15. -- part 2 (field)
  16. -- low flags: 01
  17. -- high flags: 4007
  18. -- rect: left=383 top=58 right=286 bottom=490
  19. -- title width / last selected line: 0
  20. -- icon id / first selected line: 0 / 0
  21. -- text alignment: 0
  22. -- font id: 3
  23. -- text size: 9
  24. -- style flags: 0
  25. -- line height: 12
  26. -- part name: scroller
  27.  
  28.  
  29. -- part 3 (button)
  30. -- low flags: 00
  31. -- high flags: 8003
  32. -- rect: left=76 top=298 right=320 bottom=176
  33. -- title width / last selected line: 0
  34. -- icon id / first selected line: 0 / 0
  35. -- text alignment: 1
  36. -- font id: 0
  37. -- text size: 12
  38. -- style flags: 0
  39. -- line height: 16
  40. -- part name: XScrollBoxM
  41. ----- HyperTalk script -----
  42. on mouseUp
  43.   put "1,3,5" into initial
  44.   get XScrollBoxM(initial,"Choose among these:",card field "scroller","Help")
  45.   go this card
  46.   if it is "Help" then
  47.     answer "You pushed the 'Help' button."
  48.   else if it is "cancel" then
  49.     answer "You pushed the 'Cancel' button."
  50.   else if it is empty then
  51.     answer "You did not select anything."
  52.   else
  53.     put (the number of items in it div 2) into count
  54.     if count is 1 then put "item" into itemWord
  55.     else put "items" into itemWord
  56.     answer "You chose" && count && itemWord & "."
  57.   end if
  58. end mouseUp
  59.  
  60.  
  61.  
  62. -- part 5 (field)
  63. -- low flags: 01
  64. -- high flags: 2007
  65. -- rect: left=18 top=32 right=286 bottom=384
  66. -- title width / last selected line: 0
  67. -- icon id / first selected line: 0 / 0
  68. -- text alignment: 0
  69. -- font id: 3
  70. -- text size: 10
  71. -- style flags: 0
  72. -- line height: 13
  73. -- part name: Documentation
  74.  
  75.  
  76. -- part contents for card part 2
  77. ----- text -----
  78. able
  79. baker
  80. charlie
  81. dog
  82. ernest
  83. fox
  84. gamma
  85. horse
  86. ice cream
  87. jumping jack flash
  88. knockwurst
  89. liver
  90. monkey
  91. no way, jose
  92. occularity
  93. penelope
  94. qwerty
  95. rapscallion
  96. salubrious
  97. twinkle toes
  98. underwhelmed
  99. vermin
  100. wascally wabbit
  101. yokel
  102. zenzational
  103.  
  104. -- part contents for card part 5
  105. ----- text -----
  106. XScrollBoxM version 2.4
  107. Roger Brown
  108.  
  109. XScrollBoxM is a version HyperCard XFCN XScrollBox that allows the user to make multiple selections.
  110.  
  111.  The return value is an item list in the format:
  112.     number,text,number,text,..number,text
  113.    
  114.    where number is the number of a selection 
  115.      text is the text of the selection with that number
  116.    
  117.     Selection can be made by:
  118.    
  119.    1. double-clicking on a line.
  120.    2. single-clicking on a line, then pressing the OK button.
  121.    3. single-clicking on a line, then pressing the Return key.
  122.    4. typing the first letter(s) of a selection, then doing 1,2, or 3.
  123.      (Note: type selection assumes that the lines are   
  124.                 ordered  alphabetically)
  125.    5. scrolling with up and down arrow keys, then doing 1,2 or 3.
  126.  
  127.    Multiple selection is made by holding down the shift key while    
  128.    clicking.
  129.    
  130.    If the Cancel button is pressed, the string "Cancel" is returned.
  131.     
  132.    It requires that the DITL and DLOG resources (1347) packaged 
  133.    with  it are in the stack.
  134.    
  135.   The dialog is centered on the screen and sized to hold the width of the longest line and/or the prompt line, whichever is widest. It will not overrun the width of a  Mac+ screen.
  136.  
  137. INVOKING XScrollBoxM
  138.  
  139.   get XScrollBoxM(first,prompt,container,userButton)
  140.         
  141.    where  first  is a list of 1 or more default selections in the list - 
  142.                          either numbers or an item list of text strings (0 if 
  143.                          none). NOTE: the text must exactly match what is in 
  144.                          the field!
  145.                prompt is a string to prompt the user. This appears at the 
  146.                          top  of the dialog box.
  147.                container is any hypercard container (field, variable), 
  148.                          presumed to be multi-lined.
  149.                UserButton  is the name for an optional author specified 
  150.                          button. If this button is pressed, its name is returned             
  151.                          further processing by the script.  
  152.                    
  153.  
  154. EXAMPLE
  155.  
  156.  ex.  get XScrollBoxM("1,2,3","Choose:",card field 1,"Help")
  157.         if OK is pressed, returns : 1,text of line 1 of card field 1,2,text 
  158.            of line 2 of card field 1,3,ext of line 3 of card field 3
  159.  
  160.  
  161. REVISION HISTORY
  162. 1.4 - start with XScrollBox 1.4
  163. 1.6 - multiple selection by command-shift
  164. 1.7 -- 6/5/88   multiple selection by shift only
  165. 1.8 - 5/12/89 fixed two selection by typing bugs and made source
  166.         compatible with LSC 3.0.
  167. 2.0 - 9/9/89 SuperCard compatible, fixed bugs in typing-selection,
  168.          and userButton string handling.  First item is selected if there     
  169.          is no default and the user presses a cursor arrow key. One 
  170.          source for all 3 versions, control version with compiler 
  171.          variables. Compiles under THINK C Γäó 4.0.
  172. 2.1 - 2/21/90 Puch of cancel button now returns "Cancel" string.
  173.          Fixed some bugs in allocatin and use of return handle.
  174. 2.2 - 3/29/90 Correctly displays eight-bit characters.
  175. 2.3 - 3/30/90 added XScrollBoxML version
  176. 2.4 - 4/17/90 revived a feature that had disappeared: specifying    
  177.           the default selection in XScrollBox and XScrollBox F as a 
  178.           string rather than a number
  179.  
  180.